package com.dao.DaoImpl;

import com.dao.Dao.AccountDao;
import com.dao.JavaBean.Account;
import com.util.JDBCUtil;

import javax.rmi.CORBA.Util;
import java.util.ArrayList;

public class AccountDaoImpl implements AccountDao {
    @Override
    public int insert(Account account) {
        String sql="insert into account(name,money) values(?,?)";
        return JDBCUtil.dml(sql,account.getName(),account.getMoney());
    }

    @Override
    public int addMoneyById(int id, double money) {
        String sql="update account set money=money+? where id=?";
        return JDBCUtil.dml(sql,money,id);
    }

    @Override
    public int deleteById(int id) {
        String sql="delete from account where id=?";
        return 0;
    }

    @Override
    public ArrayList<Account> select() {
        return null;
    }
}
